package com.xzkydz.serialport;


import com.xzkydz.sensor.helper.SerialHelper;

import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;


public class SerialControl extends SerialHelper {

    public volatile Queue<byte[]> QueueList = new ConcurrentLinkedQueue<byte[]>();

    public SerialControl(boolean parseCom) {
        super(parseCom);
    }

    public SerialControl(String sPort, int sBaudRate, boolean parseCom) {
        super(sPort, sBaudRate, parseCom);
    }


    public synchronized void AddQueue(byte[] buffer) {
        QueueList.add(buffer);
    }

    @Override
    protected void onDataReceived(byte[] buffer) {
        AddQueue(buffer);
    }
}
